import { Component, OnInit } from '@angular/core';
import { uniqueId } from 'lodash';

@Component({
  selector: 'app-demo11',
  templateUrl: './demo11.component.html',
  styles: [],
})
export class Demo11Component implements OnInit {
  data;
  constructor() {}

  ngOnInit() {
    this.initData();
  }

  initData() {
    this.data = Array.from({ length: 10000 }).map((item, key) => {
      return this.initUser(key);
    });
  }

  initUser(key: number) {
    return { id: uniqueId('uid'), name: `user${key}`, age: 10 + key, expand: false, random: parseInt(Math.random() * 100 + '', 10) };
  }
}
